#include <stdio.h>
#include <stddef.h>

extern int getword(char *lbuf, char *buf, size_t size, int first(char c), int rest(char c));
/**
 * Reads the next `word` from the string lbuf and stores it as a null-terminated
 * string in buf[0..size-1] and returns the length of the word (not counting the
 * terminating null character). When getword reaches the end of the string lbuf
 * without consuming a word, it return EOF. If a word is longer than size-1 cha-
 * racters, the excess characters are ignored.
 *
 * First and rest identify the characters that comprise a word: A word is a con-
 * tiguous sequence of characters that begins with a character for which first
 * returns nonzero followed by zero or more character for which rest returns nonzero.
 *
 * It is a checked runtime error for lbuf, buf, first, or rest to be NULL or for
 * size to be 0
 */
